package com.entity;

import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.RelationOneToOne;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 订单商品关联信息表 实体类。
 *
 * @author admin
 * @since 2025-05-30
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("order_products")
public class OrderProducts implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 订单商品关联项唯一标识，自增主键
     */
    @Id(keyType = KeyType.Auto)
    private Integer id;

    /**
     * 关联订单 ID，表明该商品属于哪个订单
     */
    private Integer orderId;

    /**
     * 关联商品 ID，表明订单中包含的是哪个商品
     */
    private Integer productId;

    /**
     * 商品数量，表明订单中该商品的购买数量
     */
    private Integer quantity;

    @RelationOneToOne(selfField = "productId", targetField = "id")
    private Products products;

}
